<?php include("includes/session.php"); ?>
<?php include("includes/connect_db.php"); ?>
<?php include("includes/header.php"); ?>
<?php include("notif.php"); ?>

<?php
	$idFormat = $_GET['id'];
	$sql = "SELECT id_operasi From tb_format WHERE id_format = '$idFormat'";
	$query = mysql_query($sql);
	$result = mysql_fetch_array($query);
	$idOperasi = $result['id_operasi'];

	$sql = "SELECT * FROM tb_operasi WHERE id_operasi = '$idOperasi'";
	$query = mysql_query($sql);
	$result = mysql_fetch_array($query);

	$sqlNamaSql = "SELECT * FROM tb_jenis_sql WHERE id_jenis_sql = '$result[id_jenis_sql]'";
	$queryNamaSql = mysql_query($sqlNamaSql);
	$namaSql = mysql_fetch_array($queryNamaSql);

	$sqlKarakter = "SELECT * FROM tb_master_karakter WHERE id_karakter = '$result[id_karakter]'";
	$queryKarakter = mysql_query($sqlKarakter);
	$karakter = mysql_fetch_array($queryKarakter);
?>

<style>
	.border{
		border: 1px solid #08c;
		padding: 10px;
		margin-top: 10px;
		padding: 10px;
	}
	.check{
		cursor: pointer;
	}
	.format{
		padding: 5px;
		color: #FFF;
		background: #08c;
		border-radius: 5px;
		width: 400px;
		text-align: center;
		cursor: pointer;
		margin: 5px;
		float: left;
		width: 15%;
	}
	.formatProses{
		padding: 5px;
		color: #FFF;
		background: #08c;
		border-radius: 5px;
		width: 400px;
		text-align: center;
		cursor: pointer;
		margin: 5px;
		float: right;
		width: 15%;
		box-shadow: none;
	}
	.row-fluid{ min-height: 30px; }
	.format:hover{ background: #05c;}
	.formatProses:hover{ background: #05c; }
	.disabled, .disabled:hover{ background: #aaa; }
	.butAdd{ color: #FFF; background: #08c; min-width: 20px;}
	.table-bordered{ border: none; }
	.biru{ color: #08c; }
	.font{ font-family: "courier new" }
	.contoh{ background-color: #ddd; margin: 0px; padding: 10px; }
</style>

<div class="span9">  
    <h3>SMS</h3>                      
    <ul class="breadcrumb well">
    	<li><a href="format.php">Format SMS</a> <span class="divider">/</span></li>
        <li class="active">Tambah</li>                
    </ul>    
    
	<div class="alert alert-info" style="padding: 10px;">
		<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
			<div class="row-fluid">
				<div class="span4">Pilih Koneksi Yang digunakan</div>
				<div class="span3" style="margin-left: 5px;">Pilih Jenis SQL</div>
				<div class="span1" style="margin-left: 5px;"></div>
				<div class="span3" style="margin-left: 5px;">Masukkan Keyword</div>
			</div>
			<div>
				<select id="pilihHost" name="koneksi" class="span4 host">
					<?php
						$sql_lihat_host = "SELECT * FROM tb_host";
						$query_lihat_host = mysql_query($sql_lihat_host);
						
						while ($lihat_host = mysql_fetch_array($query_lihat_host)) {
							if ($lihat_host['id_host'] == $result['id_host']) {
					?>
								<option name="koneksi" value="<?php echo $lihat_host['id_host']; ?>" selected="selected">
									<?php echo $lihat_host['nama_host']." - ".$lihat_host['db']; ?>
								</option>
					<?php
							} else {
					?>
								<option name="koneksi" value="<?php echo $lihat_host['id_host']; ?>">
									<?php echo $lihat_host['nama_host']." - ".$lihat_host['db']; ?>
								</option>

					<?php
							}
						}
					?>
				</select>
				<select id="pilihSQL" name="sql" class="span3">
					<?php
						$sql_lihat_sql = "SELECT * FROM tb_jenis_sql";
						$query_lihat_sql = mysql_query($sql_lihat_sql);
						
						while ($lihat_sql = mysql_fetch_array($query_lihat_sql)) {
							if ($lihat_sql['id_jenis_sql'] == $result['id_jenis_sql']) {
					?>
								<option name="sql" value="<?php echo $lihat_sql['jenis_sql']; ?>" selected="selected">
									<?php echo $lihat_sql['jenis_sql'] ?>
								</option>
					<?php
							} else {
					?>
								<option name="sql" value="<?php echo $lihat_sql['jenis_sql']; ?>">
									<?php echo $lihat_sql['jenis_sql'] ?>
								</option>

					<?php
							}
						}
					?>
				</select>
				<select id="pilihKarakter" name="karakter" class="span1">
					<?php
						$sql_lihat_karakter = "SELECT * FROM tb_master_karakter";
						$query_lihat_karakter = mysql_query($sql_lihat_karakter);
						
						while ($lihat_karakter = mysql_fetch_array($query_lihat_karakter)) {
							if ($lihat_karakter['id_karakter'] == $result['id_karakter']) {
					?>
								<option name="karakter" value="<?php echo $lihat_karakter['karakter']; ?>" selected="selected">
									<?php echo $lihat_karakter['karakter']; ?>
								</option>	
					<?php
							} else {
					?>
								<option name="karakter" value="<?php echo $lihat_karakter['karakter']; ?>">
									<?php echo $lihat_karakter['karakter']; ?>
								</option>

					<?php
							}
						}
					?>
				</select>
				<input id="pilihKeyword" name="keyword" type="text" placeholder="Masukkan Keyword" class="span3" value="<?php echo $result['keyword'] ?>">
				<button id="btnPilih" class="btn btn-info" style="width: 100px;" name="pilih">
					<i class="icon-white icon-ok"></i>
					Pilih
				</button>
			</div>
		</form>
	</div>

	<?php
		if ($result['id_jenis_sql'] == 1 or $result['id_jenis_sql'] == 2 or $result['id_jenis_sql'] == 3 or $result['id_jenis_sql'] == 4) {
	?>
	<div class="border" id="contohQuery">
	</div>
	<?php
		} else {
	?>
	<div class="border" id="contohQuery" style="display: none;">
	</div>
	<?php
		}
	?>


	<div class="border" id="inputDataQuery">
		<div class="row-fluid">
			<div class="format" id="pilihTable" data-jenis="1" style="display: none;">
				<i class="icon-white icon-list"></i>
				Pilih Tabel
			</div>
			<div class="format" id="pilihOutput" data-jenis="2" style="display: none;">
				<i class="icon-white icon-list"></i>
				Pilih Output
			</div>
			<div class="format" id="pilihParameter" data-jenis="3" style="display: none;">
				<i class="icon-white icon-list"></i>
				Pilih Parameter
			</div>
			<div class="format" id="pilihFunction" data-jenis="4" style="display: none;">
				<i class="icon-white icon-list"></i>
				Pilih Function
			</div>
			<div class="format" id="pilihProcedure" data-jenis="5" style="display: none;">
				<i class="icon-white icon-list"></i>
				Pilih Procedure
			</div>
			<div class="format" id="pilihFunctionParameter" data-jenis="6" style="display: none;">
				<i class="icon-white icon-list"></i>
				Pilih Parameter
			</div>
			<button class="formatProses btn btn-info pull-right" style="width: 100px;" disabled="disabled" id="proses">
				<i class="icon-white icon-ok"></i>
				Proses
			</button>
		</div>
	</div>
	
	<div class="border" id="hasilQuery" style="display: none;">
	</div>

	<div class="border" id="finishing">
		<form class="form-inline">
			<span>Hak Akses : </span>
			<select id="hakAkses" name="hakAkses" style="width: 150px;">
				<?php
					if ($result['is_publik'] == 1) {
						echo "<option name='hakAkses' value='1' selected='selected'>Public</option>";
						echo "<option name='hakAkses' value='0'>Private</option>";
					} else {
						echo "<option name='hakAkses' value='1'>Public</option>";
						echo "<option name='hakAkses' value='0' selected='selected'>Private</option>";
					}
				?>
			</select>
			<span style="margin-left: 20px;">Nama Format : </span>
			<input type="text" id="formatName" placeholder="Nama Format" value="<?php echo $result['nama_operasi']; ?>">
			<button class="btn btn-info" id="selesai">
				<i class="icon-white icon-ok"></i>
				Selesai
			</button>
		</form>
	</div>

	<div id="valuePlacer">
		<input type="hidden" id="dataOperasi" value="<?php echo $idOperasi; ?>">
		<input type="hidden" id="dataKoneksi" value="<?php echo $result['id_host']; ?>">
		<input type="hidden" id="dataSql" value="<?php echo $namaSql['jenis_sql']; ?>">
		<input type="hidden" id="dataKeyword" value="<?php echo $result['keyword']; ?>">
		<input type="hidden" id="dataTabel" value="">
		<input type="hidden" id="dataOutput" value="">
		<input type="hidden" id="dataParameter" value="">
		<input type="hidden" id="dataFunction" value="">
		<input type="hidden" id="dataFunctionParameter" value="">
		<input type="hidden" id="dataProcedure" value="">
		<input type="hidden" id="dataProcedureParameter" value="">
		<input type="hidden" id="dataHakAkses" value="<?php echo $result['is_publik'] ?>">
		<input type="hidden" id="dataNamaFormat" value="<?php echo $result['nama_operasi']; ?>">
		<input type="hidden" id="dataKarakterPemisah" value="<?php echo $karakter['karakter']; ?>">
	</div>
</div>

<?php
	if(isset($_POST['pilih'])){
		$koneksi = $_POST['koneksi'];
		$sql = $_POST['sql'];
		$keyword = $_POST['keyword'];

		if ($koneksi=="*"){
            echo "<SCRIPT> alert('Isi Data Terlebih dahulu');</SCRIPT>";
        } else{
        	echo "<SCRIPT> location.href='format-edit.php?kondb=$koneksi&sql=$sql';</SCRIPT>";
	  	}
	}
?>

<?php include("includes/footer.php"); ?>

<script type="text/javascript">
	var that;
	var temp = '';
	var tabelArr = [];
	var outputArr = [];
	var parameterArr = [];

	var formContoh = {
		sql : $('#dataSql').val()
	};

	$.ajax({
	  url: 'format-edit-contoh.php',
	  type: 'POST',
	  data: formContoh,
	  success: function(data, textStatus, xhr) {
	    $('#contohQuery').html(data);
	  }
	});

	if ($('#dataKeyword').val() != "") {
    	var sql = $('#dataSql').val();
    	if (sql == 'SELECT' || sql == 'INSERT' || sql == 'UPDATE' || sql == 'DELETE') {
    		$('#pilihTable').css('display', 'block');
    		$('#contohQuery').slideDown();
    	} else if (sql == 'FUNCTION') {
    		$('#pilihFunction').css('display', 'block');
    	} else if (sql == 'PROCEDURE'){
    		$('#pilihProcedure').css('display', 'block');
    	};

    	if (sql == 'DELETE') {
            $('#pilihParameter').slideDown();
        } else if (sql == 'INSERT') {
            $('#pilihOutput').slideDown();
        } else {
            $('#pilihOutput').slideDown();
            $('#pilihParameter').slideDown();
        };

    	$('#inputDataQuery').slideDown();
    };

    <?php
    	$sqlTabel = "SELECT * FROM tb_operasi_tabel WHERE id_operasi = '$idOperasi'";
    	$queryTabel = mysql_query($sqlTabel);
    	while ($tabel = mysql_fetch_array($queryTabel)) {
    ?>
    	tabelArr.push('<?php echo $tabel['nama_tabel'] ?>');
    	$('#dataTabel').val(tabelArr);
    <?php
    	}
    ?>

    <?php
    	$i = 1;
		$sqlOutput = "SELECT * FROM tb_operasi_output WHERE id_operasi = '$idOperasi'";
		$queryOutput = mysql_query($sqlOutput);
		$jumlah = mysql_num_rows($queryOutput);
		$queryOutput = mysql_query($sqlOutput);
		while ($output = mysql_fetch_array($queryOutput)) {
	?>
			var tempOutput = ['<?php echo $output[output] ?>', '<?php echo $output[nama_output] ?>', '<?php echo $output[agregat] ?>'];
			outputArr.push(tempOutput);
			$('#dataOutput').val(outputArr);
	<?php
		}
	?>

    <?php
		$sqlParameter = "SELECT * FROM tb_operasi_parameter WHERE id_operasi = '$idOperasi'";
		$queryParameter = mysql_query($sqlParameter);
		$jumlah = mysql_num_rows($queryParameter);
		$queryParameter = mysql_query($sqlParameter);
		while ($parameter = mysql_fetch_array($queryParameter)) {
	?>
			var tempParameter = ['<?php echo $parameter[parameter] ?>', '<?php echo $parameter[nama_parameter] ?>', '<?php echo $parameter[type] ?>'];
			parameterArr.push(tempParameter);
			$('#dataParameter').val(parameterArr);
	<?php
		}
	?>
		
	var formTabel = {
        host: $('#valuePlacer').find('#dataKoneksi').val(),
        namaTabel : $('#output').data("id"),
        tabel : $('#dataTabel').val(),
        idOperasi : $('#dataOperasi').val()
    };

    $.ajax({
      url: 'format-edit-modal-output-rincian_tabel.php',
      type: 'POST',
      data: formTabel,
      success: function(data, textStatus, xhr) {
        $('.rincianOutput').slideUp("medium", function(){
            $('.rincianOutput').html(data);
            $('.idOutput').each(function(){
                var that = $(this);
                for (var i = 0; i < outputArr.length; i++) {
                    if(outputArr[i].indexOf(that.val())!=-1){
                        var check = that.closest('tr').find('.check');
                        check.css('opacity', '1');
                        check.parent('td').find('.checkOutput').attr('checked', 'checked');
                        that.closest('tr').css('background-color', '#ddd');
                        that.closest('tr').find('.descOutput').html("<span style='margin-right: 30px'>"+outputArr[i][1]+"</span><span>"+outputArr[i][2]+"</span>");
                    }
                };
            });
            $('.rincianOutput').slideDown("medium");
        });
      }
    });

	$('#proses').removeAttr('disabled');

	$('#hasilQuery').slideUp();
	
	$('#finishing').slideUp();
	var formQuery = {
		host : $('#dataKoneksi').val(),
		sql : $('#dataSql').val(),
		keyword : $('#dataKeyword').val(),
		tabel : $('#dataTabel').val(),
		output : $('#dataOutput').val(),
		parameter : $('#dataParameter').val(),
		fungsi : $('#dataFunction').val(),
		fungsiParameter : $('#dataFunctionParameter').val(),
		prosedur : $('#dataProcedure').val(),
		prosedurParameter : $('#dataProcedureParameter').val(),
		karakter : $('#dataKarakterPemisah').val()
	};

	$.ajax({
	  url: 'format-edit-result.php',
	  type: 'POST',
	  data: formQuery,
	  success: function(data, textStatus, xhr) {
	    $('#hasilQuery').html(data);
	  }
	});
	$('#hasilQuery').slideDown();
	$('#finishing').slideDown();




	$(document).ready(function() {
		$('.format').live('click',function(){
			that = $(this);
	        $("#tampil-modal").fadeOut("medium",function(){
        		var formFormat = {
        			host: $('#pilihHost').val(),
        			sql: $('#pilihSQL').val(),
        			jenis: that.data('jenis'),
        			tabel: $('#dataTabel').val()
        		};
	            $.ajax({
	                url: "format-edit-modal.php", 
        		  	type: 'POST',
        		  	data: formFormat,
	                cache: false, 
	                success: function(kontak){ 
	                    $("#tampil-modal").html(kontak);
	                    $("#tampil-modal").fadeIn("medium");
	                } 
	            });
	        });
	        return false;
		});

		$('#btnPilih').click(function(){
            $('#dataKoneksi').val($('#pilihHost').val());
            $('#dataSql').val($('#pilihSQL').val());
            $('#dataKeyword').val($('#pilihKeyword').val());
            $('#dataKarakterPemisah').val($('#pilihKarakter').val());

			$('#contohQuery').slideUp();
			$('#inputDataQuery').slideUp();
			$('#hasilQuery').slideUp();
			$('#pilihOutput').slideUp();
            $('#pilihParameter').slideUp();
            $('#pilihFunctionParameter').slideUp();
			$('#finishing').slideUp();
            $('#pilihTable').css('display', 'none');
            $('#pilihFunction').css('display', 'none');
            $('#pilihProcedure').css('display', 'none');

			var formContoh = {
				sql : $('#dataSql').val()
			};

			$.ajax({
			  url: 'format-edit-contoh.php',
			  type: 'POST',
			  data: formContoh,
			  success: function(data, textStatus, xhr) {
			    $('#contohQuery').html(data);
			  }
			});

            $('#proses').attr('disabled', 'disabled');
            if ($('#dataKeyword').val() != "") {
            	var sql = $('#dataSql').val();
            	if (sql == 'SELECT' || sql == 'INSERT' || sql == 'UPDATE' || sql == 'DELETE') {
            		$('#pilihTable').css('display', 'block');
            		$('#contohQuery').slideDown();
            	} else if (sql == 'FUNCTION') {
            		$('#pilihFunction').css('display', 'block');
            	} else if (sql == 'PROCEDURE'){
            		$('#pilihProcedure').css('display', 'block');
            	};
            	$('#inputDataQuery').slideDown();
            };
            return false;
        });

        $('#proses').click(function(){
			$('#hasilQuery').slideUp();
			$('#finishing').slideUp();
			var formQuery = {
				host : $('#dataKoneksi').val(),
				sql : $('#dataSql').val(),
				keyword : $('#dataKeyword').val(),
				tabel : $('#dataTabel').val(),
				output : $('#dataOutput').val(),
				parameter : $('#dataParameter').val(),
				fungsi : $('#dataFunction').val(),
				fungsiParameter : $('#dataFunctionParameter').val(),
				prosedur : $('#dataProcedure').val(),
				prosedurParameter : $('#dataProcedureParameter').val(),
				karakter : $('#dataKarakterPemisah').val()
			};

			$.ajax({
			  url: 'format-edit-result.php',
			  type: 'POST',
			  data: formQuery,
			  success: function(data, textStatus, xhr) {
			    $('#hasilQuery').html(data);
			  }
			});
			$('#hasilQuery').slideDown();
			$('#finishing').slideDown();
            return false;
        });

        $('#formatName').live('keyup', function(){
        	if ($(this).val() == '') {
        		$('#selesai').attr('disabled', 'disabled');	
        	} else{
        		$('#selesai').removeAttr('disabled', 'disabled');
        	}
        });

        $('#formatName').live('blur', function(){
        	if ($(this).val() == '') {
        		$('#selesai').attr('disabled', 'disabled');	
        	} else{
        		$('#selesai').removeAttr('disabled', 'disabled');
        	}
        });

        $('#selesai').click(function(){
        	$('#dataHakAkses').val($('#hakAkses').val());
        	$('#dataNamaFormat').val($('#formatName').val());

        	var formQuery = {
				host : $('#dataKoneksi').val(),
				sql : $('#dataSql').val(),
				keyword : $('#dataKeyword').val(),
				tabel : $('#dataTabel').val(),
				output : $('#dataOutput').val(),
				parameter : $('#dataParameter').val(),
				fungsi : $('#dataFunction').val(),
				fungsiParameter : $('#dataFunctionParameter').val(),
				hakAkses : $('#dataHakAkses').val(),
				formatName : $('#dataNamaFormat').val(),
				karakter : $('#dataKarakterPemisah').val()
			};

			$.ajax({
			  	url: 'act_format.php',
				type: 'POST',
				data: formQuery,
				success: function(msg){
					window.location = "format.php";
				}
			});

       		return false;
        });

        $('#output').find('.check').live('click', function(){
            var x = $(this);
            if (x.parent('td').find('.checkOutput').is(':checked')) {
                x.animate({
                    opacity: '0.2'
                }, function(){
                    x.parent('td').find('.checkOutput').removeAttr('checked');
                    x.closest('tr').find('.descOutput').html("");
					x.closest('tr').css('background-color', '#fff');
					for (var i = 0; i < outputArr.length; i++) {
						var indexArr = outputArr[i].indexOf(x.closest('tr').find('.idOutput').val());
						if(indexArr!=-1){
							outputArr.splice(i, 1);
							$('#dataOutput').val(outputArr);
						}
					};
                });
            }else{
                x.animate({
                    opacity: '1'
                }, function(){
                    x.parent('td').find('.checkOutput').attr('checked', 'checked');
                    x.closest('tr').find('.descOutput').append(
                    	"<div class='input-append'>"+
							"<input type='text' class='textOutput' placeholder='Masukkan Nama Output'>"+
							"<select style='width: 100px;' name='agregat' class='agregat'>"+
								"<option name='agregat' value=''>"+
								"</option>"+
								"<?php 
									$sql_ambil_data = 'SELECT * FROM tb_master_agregat';
									$query_ambil_data = mysql_query($sql_ambil_data);
									while($ambil_data = mysql_fetch_array($query_ambil_data)){
								?>"+
									"<option name='agregat' value='<?php echo $ambil_data[agregat]; ?>'>"+
										"<?php echo $ambil_data[agregat]; ?>"+
									"</option>"+
								"<?php
									}
								?>"+
							"</select>"+
	                        "<button class='btn butAdd' type='button'><i class='icon-white icon-ok'></i></button>"+
                        "<div>");
                });  
            }
        });

		$('#parameter').find('.check').live('click', function(){
            var x = $(this);
            if (x.parent('td').find('.checkParameter').is(':checked')) {
                x.animate({
                    opacity: '0.2'
                }, function(){
                    x.parent('td').find('.checkParameter').removeAttr('checked');
                    x.closest('tr').find('.descParameter').html("");
					x.closest('tr').css('background-color', '#fff');
					for (var i = 0; i < parameterArr.length; i++) {
						var indexArr = parameterArr[i].indexOf(x.closest('tr').find('.idParameter').val());
						if(indexArr!=-1){
							parameterArr.splice(i, 1);
							$('#dataParameter').val(parameterArr);
							if ($('#dataParameter').val() == '') {
								$('#proses').attr('disabled', 'disabled');
							};
						}
					};
                });
            }else{
                x.animate({
                    opacity: '1'
                }, function(){
                    x.parent('td').find('.checkParameter').attr('checked', 'checked');
                    x.closest('tr').find('.descParameter').append(
                    	"<div class='input-append'>"+
                    		"<select class='tipe_operasi' style='width: 50px;'>"+
                    			"<option value='<'><</option>"+
                    			"<option value='<='><=</option>"+
                    			"<option value='>'>>=</option>"+
                    			"<option value='='>=</option>"+
                    			"<option value='!='>!=</option>"+
                    			"<option value='like'>like</option>"+
                    		"</select>"+
                    		"<input type='text' class='textParameter' placeholder='Masukkan Nama Parameter'>"+
                            "<button class='btn butAdd' type='button'><i class='icon-white icon-ok'></i></button>"+
                        "<div>");
                });  
            }
        });
		
		$('#output').find('.butAdd').live('click', function(){
			
			if ($('.textOutput').val() != '') {
				var outputSecArr = [];
				var x = $(this);
				if (x.parent('div').find('.agregat').val()=='') {
					temp = '';
				} else {
					temp = x.parent('div').find('.agregat').val();
				};
				outputSecArr.push(x.closest('tr').find('.idOutput').val());
				outputSecArr.push(x.parent('div').find('.textOutput').val());
				outputSecArr.push(temp);
				outputArr.push(outputSecArr);
				x.closest('tr').css('background-color', '#ddd');
				x.closest('td').html("<span style='margin-right: 30px'>"+x.parent('div').find('.agregat').val()+"</span><span>"+x.parent('div').find('.textOutput').val()+"</span>");
	            $('#dataOutput').val(outputArr);
	            var sql = $('#dataSql').val();
	            var parameter = $('#dataParameter').val();
	            if (sql == 'INSERT') {
	            	$('#proses').removeAttr('disabled');
	            } else if (sql !== 'DELETE') {
	            	if (parameter !== '') {
	            		$('#proses').removeAttr('disabled');
	            	};
	            };
			};
		});
		
		$('#parameter').find('.butAdd').live('click', function(){
			if ($('.textParameter').val() != '') {
				var parameterSecArr = [];
				var x = $(this);
				parameterSecArr.push(x.closest('tr').find('.idParameter').val());
				parameterSecArr.push(x.parent('div').find('.textParameter').val());
				parameterSecArr.push(x.parent('div').find('.tipe_operasi').val());
				parameterArr.push(parameterSecArr);
				x.closest('tr').css('background-color', '#ddd');
				var tipe_par = x.parent('div').find('.tipe_operasi').val();
				var nama_par = x.parent('div').find('.textParameter').val();
				x.closest('td').html("<span style='margin-right: 30px'>"+tipe_par+"</span><span>"+nama_par+"</span>");
	            $('#dataParameter').val(parameterArr);
	            var sql = $('#dataSql').val();
	            var output = $('#dataOutput').val();
	            if (sql !== 'DELETE') {
	            	if (output !== '') {
	            		$('#proses').removeAttr('disabled');
	            	};
	            } else{
					$('#proses').removeAttr('disabled');
	            };
	        };
		});
	});
</script>